const payment = (data = {}, success, fail) => {
	uni.requestPayment({
		orderInfo: data.tradeNo,
		timeStamp: data.timeStamp + '',
		nonceStr: data.nonceStr,
		package: data.package,
		signType: data.signType,
		paySign: data.paySign,
		success(sus) {
			console.log(sus);
			if (data.tradeNo) { //支付宝支付
				if (sus.resultCode == "9000") {
					success(sus);
					uni.showToast({
						title: '支付成功',
						icon: 'success',
						duration: 1000
					});
				} else {
					fail(sus)
				}
			} else {
				success(sus);
				uni.showToast({
					title: '支付成功',
					icon: 'success',
					duration: 1000
				});
			}
		},
		fail(err) {
			console.log(err)
			fail(err)
		}
	})
}
export default payment
